package jm.data.structure.tree;

import jm.data.structure.tree.printer.BinaryTrees;
import jm.data.structure.utils.PrintUtils;

import java.util.Comparator;

/**
 * @Description 二叉搜索树测试
 * @date 2022/4/9 14:44
 */
public class BinarySearchTreeMain<E> {
    public static void main(String[] args) {
        Integer[] data = {7, 4, 9, 2, 5, 8, 11, 3, 12, 1};
        BinarySearchTree<Integer> bst1 = new BinarySearchTree<>();

        System.out.println(bst1.isEmpty());

        for (int i = 0; i < data.length; i++) {
            bst1.add(data[i]);
        }

        System.out.println(bst1.isEmpty());
        BinaryTrees.print(bst1);

        bst1.remove(7);
        System.out.println(bst1.size());
        BinaryTrees.print(bst1);

        bst1.remove(4);
        System.out.println(bst1.size());
        BinaryTrees.print(bst1);

        bst1.clear();
    }
}
